@echo off
mkdir logs\%db2_server_name%

set logfile=logs\%db2_server_name%\%1.sql

db2 -x select varchar(text,32670)  from syscat.routines where routinename=upper('%1') > %logfile%
echo ---------------------------------tables ---------------------------------- >> %logfile%
db2 -x "select LTRIM(RTRIM(BSCHEMA))||'.'|| LTRIM(RTRIM(bname))  from syscat.packagedep where (btype='T' or btype='V') and pkgname in(select bname from sysibm.sysdependencies where dname =upper('%1')) order by bname" >> %logfile%
start  %logfile%
